#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:

    vector<vector<int> > flipChess(vector<vector<int> >& A, vector<vector<int> >& f) {
        int dx[4] = { 0, 0, 1, -1 };
        int dy[4] = { 1, -1, 0, 0 };
        for (auto fp : f)
        {
            int x = fp[0] - 1, y = fp[1] - 1;
            for (int k = 0; k < 4; k++)
            {
                int a = x + dx[k], b = y + dy[k];
                if (a >= 0 && a < 4 && b >= 0 && b < 4) A[a][b] = (A[a][b] ? 0 : 1);
            }
        }
        return A;
    }
};